<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script type="text/javascript">
    //1. 
        // function Test(){
        //     this.name = name;
        //     this.age = age;
        // }
        // obj = {}
        // function t(name,age){
        //     Text.apply(this,[name,age]);
        //     Text.call(this,name,age)

        // }

    //分别使用call，apply为obj添加name，age属性

    //2.
        //实现周飘买车，其中有sayHi方法，功能:打印'周飘买了一辆红色的2.0宝马车'

        function Peoson(name,age){
            this.name = name;
            this.age = age;
        }
        function Car(name,age,color,displacement,brand){
            Peoson.call(this,name,age)
            this.brand = brand;
            this.color = color;
            this.displacement = displacement;
        }
        Car.prototype.sayHi = function(){
            console.log(this.name+this.age+'买了一辆'+this.color,this.displacement,this.brand);
        }
        var car = new Car('周飘','18岁','红色的','2.0','宝马车');
        car.sayHi();

        
    //3.使用圣杯模式实现：
        //父类：Shape
        //:Circle（求圆面积）


</script>
<body>
    
</body>
</html>